var allSelected = false; //用于搜索框的checkbox
var userNameValid = false;
var passwordValid = false;
var captchaValid = false;

var registUserNameValid = false;
var registPhoneEmailValid = false;
var registPasswordValid = false;
//var registConfirmValid = false;
var registCaptchaValid = false;

var assortmentSelectUp = true;
var assortmentselectSubUlUp = true;
var strings = "hello world";
var slideDiv = $('<div class="Cgraverobber-slide-div">' +
	'<ul class="Cgraverobber-slide-ul">' +
	'<li>' +
	'<a href="#"><img src="<%=request.getContextPath()%>/img/算导.png"/></a>' +
	'</li>' +
	'<li>' +
	'<a href="#"><img src="<%=request.getContextPath()%>/img/js.png" /></a>' +
	'</li>' +
	'<li>' +
	'<a href="#"><img src="<%=request.getContextPath()%>/img/jq.png" /></a>' +
	'</li>' +
	'<li>' +
	'<a href="#"><img src="<%=request.getContextPath()%>/img/html5.png" /></a>' +
	'</li>' +
	'<li>' +
	'<a href="#"><img src="<%=request.getContextPath()%>/img/css.png" alt="JavaWeb" /></a>' +
	'</li>' +
	'<li>' +
	'<a href="#"><img src="<%=request.getContextPath()%>/img/javaweb.png" alt="JavaScript高级程序设计" /></a>' +
	'</li>' +
	'</ul>' +
	'<div class="slide-circle c1"></div><div class="slide-circle c2"></div><div class="slide-circle c3"></div><div class="slide-circle c4"></div><div class="slide-circle c5"></div><div class="slide-circle c6"></div></div>');


var countHotUpload = '<div class="docss"><p class="count"><span class="fa fa-share-alt-square fa-fw"></span>E-TOP在线海量文档<span class="number first-number">0</span><span class="number">0</span><span class="number">0</span><span class="number">3</span><span class="number">9</span><span class="number">7</span><span class="number">6</span><span class="number">3</span></p></div><div class="hot-search-comment"><div class="container-3d"><div class="hot-search"><p class="title">最近热搜</p><ul><li><a href="#"><span class="fa fa-file-word-o fa-fw"></span>华南农业大学作息时间表</a></li><li><a href="#"><span class="fa fa-file-pdf-o fa-fw"></span>华南农业大学招生简章</a></li><li><a href="#"><span class="fa fa-file-powerpoint-o fa-fw"></span>华南农业大学校园生活</a></li><li><a href="#"><span class="fa fa-file-excel-o fa-fw"></span>华南农业大学专业介绍</a></li><li><a href="#"><span class="fa fa-file-word-o fa-fw"></span>华南农业大学信息学院</a></li><li><a href="#"><span class="fa fa-file-powerpoint-o fa-fw"></span>华南农业大学计算机科学与技术</a></li></ul></div><div class="hot-search hot-search1"><p class="title">最近热搜</p><ul><li><a href="#"><span class="fa fa-file-word-o fa-fw"></span>社会主义核心价值观与中国梦</a></li><li><a href="#"><span class="fa fa-file-pdf-o fa-fw"></span>大学生同室操戈背后凸显深层次问题</a></li><li><a href="#"><span class="fa fa-file-powerpoint-o fa-fw"></span>中国梦与当代大学生的精神成长</a></li><li><a href="#"><span class="fa fa-file-excel-o fa-fw"></span>大学物理创新性实验的设计及实施</a></li><li><a href="#"><span class="fa fa-file-word-o fa-fw"></span>把立德树人作为教育根本任务</a></li><li><a href="#"><span class="fa fa-file-powerpoint-o fa-fw"></span>齐鲁书画鉴赏</a></li></ul></div></div><div class="container-3d1"><div class="hot-upload"><p class="title">上传排行</p><div class="one-person"><a><img src="img/默认头像.jpg" /><span><span class="name">winty</span><span class="count"><span class="fa fa-upload fa-fw"></span>153</span></span></a></div><div class="one-person"><a><img src="img/默认头像.jpg" /><span><span class="name">Cgraverobber</span><span class="count"><span class="fa fa-upload fa-fw"></span>150</span></span></a></div><div class="one-person"><a><img src="img/默认头像.jpg" /><span><span class="name">志军</span><span class="count"><span class="fa fa-upload fa-fw"></span>130</span></span></a></div><div class="one-person"><a><img src="img/默认头像.jpg" /><span><span class="name">建辉</span><span class="count"><span class="fa fa-upload fa-fw"></span>120</span></span></a></div></div><div class="hot-upload hot-upload2"><p class="title">上传排行</p><div class="one-person"><a><img src="img/默认头像.jpg" /><span><span class="name">督翔</span><span class="count"><span class="fa fa-upload fa-fw"></span>122</span></span></a></div><div class="one-person"><a><img src="img/默认头像.jpg" /><span><span class="name">诗林</span><span class="count"><span class="fa fa-upload fa-fw"></span>136</span></span></a></div><div class="one-person"><a><img src="img/默认头像.jpg" /><span><span class="name">明键</span><span class="count"><span class="fa fa-upload fa-fw"></span>110</span></span></a></div><div class="one-person"><a><img src="img/默认头像.jpg" /><span><span class="name">嘉兴</span><span class="count"><span class="fa fa-upload fa-fw"></span>115</span></span></a></div></div></div></div>'
var assortHot = $("<p class='hot'><span class='fa fa-fire fa-fw'></span>热门推荐:</p>")

$(function() {
	setBodyMinHeight();
	addContent();
	loginRegistListener();
	checkBoxListener();
	loginValidate(); //登录表单验证
	registValidate(); //注册表单验证
	assortmentButtonListener();
	addStyle();
	latestScrolling();
	rotate3d();
	setScrollStyle();
        addDisabledListener();
	//	$.ajax({
	//			type: "post", //使用get方法访问后台
	//			dataType: "json", //返回json格式的数据
	//			url: "", //要访问的后台地址
	//			data: "test:" + strings, //要发送的数据
	//			complete: function() {
	//				alert("complete");
	//			}, //AJAX请求完成时隐藏loading提示
	//			success: function(msg) { //msg为返回的数据，在这里做数据绑定
	//				alert(msg);
	//			}
	//		)
	//	};
})


function loginRegistListener() {
	$(".login div:first-child input").focus();
	$(".change-login").click(function() {
		$(this).addClass("active");
		$(".change-regist").removeClass("active");
		setTimeout(function() {
			$(".login div:first-child input").focus();
		}, 0)
		$(".login").css({
			"display": "block"
		});
		$(".regist").css({
			"display": "none"
		});
		$(".array").animate({
			"top": "51px"
		}, 200);
	});

	$(".change-regist").click(function() {
		$(this).addClass("active");
		$(".change-login").removeClass("active");
		setTimeout(function() {
			$(".regist div:first-child input").focus();
		}, 0)
		$(".regist").css({
			"display": "block"
		});
		$(".login").css({
			"display": "none"
		});
		$(".array").animate({
			"top": "131px"
		}, 200);
	});
}

function checkBoxListener() {
	$("input[type='checkbox']").prop('checked', true);
	$("#all").click(function() {
		if (!allSelected) {
			$(".search-form input[type='checkbox']").prop('checked', true);
			allSelected = true;
		} else {
			$(".search-form input[type='checkbox']").removeAttr('checked', false);
			allSelected = false;
		}
	});
	$(".search-form input[type='checkbox']:not(#all)").click(function() {
		if (checkAllCheckBox()) {
			$("#all").prop('checked', true);
		} else {
			$("#all").removeAttr('checked', false);
		}
	});
}

function checkAllCheckBox() {
	if ($("#doc").prop("checked") == false ||
		$("#ppt").prop("checked") == false ||
		$("#txt").prop("checked") == false ||
		$("#pdf").prop("checked") == false ||
		$("#xls").prop("checked") == false) {
		return false;
	} else {
		return true;
	}
}

function loginValidate() {

		var loginUserName = $(".all-page .login .adjust-icon:first-child input");
		var loginPassword = $(".all-page .login .adjust-icon:nth-child(2) input");
		var loginCaptcha = $(".all-page .login .adjust-icon:nth-child(3) input"); //Captcha验证码
		var submitButton = $(".all-page .login input[type='submit']");

		loginUserName.blur(function() {
			checkUserName($(this).val(), loginUserName);
		});

		loginPassword.blur(function() {
			checkPassword($(this).val(), loginPassword, loginUserName);
		})

		loginCaptcha.blur(function() {
			checkCaptcha($(this).val(), loginCaptcha);
		})

		submitButton.click(function() {
			loginUserName.trigger("blur");
			loginPassword.trigger("blur");
			loginCaptcha.trigger("blur");
			if (userNameValid && passwordValid && captchaValid) {
				return true;
			} else {
				return false;
			}
		});
	}
	/*
	 * userName
	 ***********************************************/

function checkUserName(userName, loginUserName) {
		if (!userName.trim().length == 0) {
			$.ajax({
				type: "post", //使用get方法访问后台
				dataType: "json", //返回json格式的数据
				url: "checkUsername", //要访问的后台地址
				data: {
					username: userName
				}, //要发送的数据
				complete: function() {}, //AJAX请求完成时隐藏loading提示
				success: function(msg) { //msg为返回的数据，在这里做数据绑定
                                    var jsonObj = msg;
                                    if (jsonObj.isUserExist) {
						$(".userNameTip").remove();
						loginUserName.after("<span class='userNameTip fa fa-check fa-fw'></span>");
						userNameValid = true;
					} else {
						$(".userNameTip").remove();
						loginUserName.after("<span class='userNameTip'>" + userName + "不存在，请重新输入</span>");
						userNameValid = false;
					}
				}
			});
		} else {
			$(".userNameTip").remove();
			loginUserName.after("<span class='userNameTip'>用户名不能为空</span>");
		}
	}
	/*
	 * password
	 *******************************1****************/

function checkPassword(passwords, loginPassword, userName) {
	if (userNameValid) {
		if (!passwords.trim().length == 0) {
			$.ajax({
				type: "post", //使用get方法访问后台
				dataType: "json", //返回json格式的数据
				url: "checkPassword", //要访问的后台地址
				data: {
					username: userName.val(),
					password: passwords
				}, //要发送的数据
				complete: function() {}, //AJAX请求完成时隐藏loading提示
				success: function(msg) { //msg为返回的数据，在这里做数据绑定
                                        var jsonObj = msg;
					if (jsonObj.isUserExist) {
						$(".passwordTip").remove();
						loginPassword.after("<span class='passwordTip fa fa-check fa-fw'></span>");
						passwordValid = true;
					} else {
						$(".passwordTip").remove();
						loginPassword.after("<span class='passwordTip'>密码错误</span>");
						passwordValid = false;
					}
				}
			});
		} else {
			$(".passwordTip").remove();
			loginPassword.after("<span class='passwordTip'>密码不能为空</span>");
		}
	}
}

function isPasswordCorrect(passwords, userName) {

	}
	/*
	 * captcha
	 ***********************************************/

function checkCaptcha(captcha, loginCaptcha) {
	if (!captcha.trim().length == 0) {
		if (!isCaptchaCorrect(captcha)) {
			$(".captchaTip").remove();
			loginCaptcha.after("<span class='captchaTip'>验证码错误</span>")
		} else {
			$(".captchaTip").remove();
			loginCaptcha.after("<span class='captchaTip fa fa-check fa-fw'></span>")
		}
	} else {
		$(".captchaTip").remove();
		loginCaptcha.after("<span class='captchaTip'>验证码不能为空</span>")
	}
}

function isCaptchaCorrect(captcha) {
		if (captcha == "l2xv") {
			captchaValid = true;
			registCaptchaValid = true;
			return true;
		} else {
			captchaValid = false;
			registCaptchaValid = false;
			return false;
		}
	}
	/*
	 *注册 表单验证
	 ***********************************************/

function registValidate() {
	var registUserName = $(".all-page .regist .adjust-icon:first-child input");
	var registPhoneOrEmail = $(".all-page .regist .adjust-icon:nth-child(2) input");
	var registPassword = $(".all-page .regist .adjust-icon:nth-child(3) input");
	//	var registConfirm = $(".all-page .regist .adjust-icon:nth-child(4) input");
	var registCaptcha = $(".all-page .regist .adjust-icon:nth-child(4) input");
	var registSubmit = $(".all-page .regist input[type='submit']");

	registUserName.blur(function() {
		checkRegistUserName($(this).val(), registUserName);
	});

	registPhoneOrEmail.blur(function() {
		checkRegistPhoneOrEmail($(this).val(), registPhoneOrEmail);
	});

	registPassword.blur(function() {
		checkRegistPassword($(this).val(), registPassword);
	});
	//
	//	registConfirm.blur(function() {
	//		checkRegistConfirm($(this).val(), registPassword.val(), registConfirm);
	//	});

	registCaptcha.blur(function() {
		//调用了登录的验证 验证码是否正确的功能
		checkCaptcha($(this).val(), registCaptcha);
	});

	registSubmit.click(function() {
		registUserName.trigger("blur");
		registPhoneOrEmail.trigger("blur");
		registPassword.trigger("blur");
		//		registConfirm.trigger("blur");
		registCaptcha.trigger("blur");
		if (registCaptchaValid && registPasswordValid && registPhoneEmailValid && registUserNameValid) {
			return true;
		} else {
			return false;
		}
	});
}

/*
 *以下是 注册 用户名验证：
 ***********************************************/
function checkRegistUserName(registUserName, registUserNameInput) {

	$.ajax({
		type: "post", //使用get方法访问后台
		dataType: "json", //返回json格式的数据
		url: "checkUsername", //要访问的后台地址
		data: {
			username: registUserName
		}, //要发送的数据
		complete: function() {}, //AJAX请求完成时隐藏loading提示
		success: function(msg) { //msg为返回的数据，在这里做数据绑定
                                        var jsonObj = msg;
			if (jsonObj.isUserExist) {
				registUserNameValid = false;
				$(".registUserNameTip").remove();
				registUserNameInput.after("<span class='registUserNameTip'>用户名已存在</span>");
			} else {
				if (!registUserName.trim().length == 0) {
					if (registUserName.length <= 20) {
						if (isRegistUserNameCorrect(registUserName)) {
							registUserNameValid = true;
							$(".registUserNameTip").remove();
							registUserNameInput.after("<span class='registUserNameTip fa fa-check fa-fw'></span>");
						} else {
							registUserNameValid = false;
							$(".registUserNameTip").remove();
							registUserNameInput.after("<span class='registUserNameTip'>只能包含：中文、数字、字母、下划线</span>");
						}
					} else {
						registUserNameValid = false;
						$(".registUserNameTip").remove();
						registUserNameInput.after("<span class='registUserNameTip'>用户名长度不能超过20个字符</span>");
					}
				} else {
					registUserNameValid = false;
					$(".registUserNameTip").remove();
					registUserNameInput.after("<span class='registUserNameTip'>用户名不能为空</span>");
				}
			}
		}
	});
}

function isRegistUserNameCorrect(registUserName) {
	//中文、字母、数字、下划线
	var reg = new RegExp("^[A-Za-z0-9_\u4E00-\u9FA5]+$");
	if (reg.test(registUserName)) {
		return true;
	} else {
		return false;
	}
}

/*
 *以下是 注册 手机 或 邮箱验证
 ***********************************************/

function checkRegistPhoneOrEmail(PhoneOrEmail, phoneOrEmailInput) {
	if (!PhoneOrEmail.trim().length == 0) {
		var reg = new RegExp("^.*@+.*$");
		if (reg.test(PhoneOrEmail)) {
			var emailReg = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$");
			if (emailReg.test(PhoneOrEmail)) {
				registPhoneEmailValid = true;
				$(".registPhoneOrEmailTip").remove();
				phoneOrEmailInput.after("<span class='registPhoneOrEmailTip fa fa-check fa-fw'></span>");
			} else {
				registPhoneEmailValid = false;
				$(".registPhoneOrEmailTip").remove();
				phoneOrEmailInput.after("<span class='registPhoneOrEmailTip'>邮箱格式错误</span>");
			}
		} else {
			var phoneReg = new RegExp("^1[3|4|5|8][0-9]{9}$");
			if (phoneReg.test(PhoneOrEmail)) {
				registPhoneEmailValid = true;
				$(".registPhoneOrEmailTip").remove();
				phoneOrEmailInput.after("<span class='registPhoneOrEmailTip fa fa-check fa-fw'></span>");
			} else {
				registPhoneEmailValid = false;
				$(".registPhoneOrEmailTip").remove();
				phoneOrEmailInput.after("<span class='registPhoneOrEmailTip'>手机号码格式错误</span>");
			}
		}
	} else {
		registPhoneEmailValid = false;
		$(".registPhoneOrEmailTip").remove();
		phoneOrEmailInput.after("<span class='registPhoneOrEmailTip'>手机或邮箱不能为空</span>");
	}
}

/*
 *以下是 注册 密码
 ***********************************************/

function checkRegistPassword(registPassword, registPasswordInput) {
	if (!registPassword.trim().length == 0) {
		if (registPassword.length >= 5 && registPassword.length <= 20) {
			var passwordReg = new RegExp("^[A-Za-z0-9\@\!\#\$\%\^\&\*\.\~]+$");
			if (passwordReg.test(registPassword)) {
				registPasswordValid = true;
				$(".registpasswordTip").remove();
				registPasswordInput.after("<span class='registpasswordTip fa fa-check fa-fw'></span>");
			} else {
				registPasswordValid = false;
				$(".registpasswordTip").remove();
				registPasswordInput.after("<span class='registpasswordTip'>只能为数字、字母和字符~!@#$%^&*.</span>");
			}
		} else {
			registPasswordValid = false;
			$(".registpasswordTip").remove();
			registPasswordInput.after("<span class='registpasswordTip'>密码长度须大于5且小于20个字符</span>")
		}
	} else {
		registPasswordValid = false;
		$(".registpasswordTip").remove();
		registPasswordInput.after("<span class='registpasswordTip'>密码不能为空</span>")
	}
}

/*
 *以下是 注册 密码确认
 ***********************************************/

//function checkRegistConfirm(registConfirm, registPassword, registConfirmInput) {
//		if (registConfirm == registPassword) {
//			if (registConfirm.length != 0) {
//				registConfirmValid = true;
//				$(".registConfirmTip").remove();
//				registConfirmInput.after("<span class='registConfirmTip fa fa-check fa-fw'></span>");
//			}
//		} else {
//			registConfirmValid = false;
//			$(".registConfirmTip").remove();
//			registConfirmInput.after("<span class='registConfirmTip'>前后密码不一致，请重新输入</span>");
//		}
//	}
/*
 * select-button 点击 分类 slideDown/slideUp
 * *********************************************/

function assortmentButtonListener() {
		$(".home-page .assortment .select-button").click(function() {
			if (assortmentSelectUp) {
				$(this).find("span").removeClass("fa-angle-double-down");
				$(this).find("span").addClass("fa-angle-double-up");
				$(".home-page .assortment .select-button+ul").slideDown("fast");
				assortmentSelectUp = false;
			} else {
				$(this).find("span").removeClass("fa-angle-double-up");
				$(this).find("span").addClass("fa-angle-double-down");
				$(".home-page .assortment .select-button+ul").slideUp("fast");
				assortmentSelectUp = true;
			}
		});
		$(".home-page .assortment .select-button+ul>li").click(function() {
			if (assortmentselectSubUlUp) {
				$(this).find("a span").removeClass("fa-plus-circle")
				$(this).find("a span").addClass("fa-minus-circle");
				$(this).find("ul").slideDown("fast");
				assortmentselectSubUlUp = false;
			} else {
				$(this).find("a span").removeClass("fa-minus-circle")
				$(this).find("a span").addClass("fa-plus-circle");
				$(this).find("ul").slideUp("fast");
				assortmentselectSubUlUp = true;
			}
		})
	}
	/*
	 * add style
	 */

function addStyle() {
	$(".all-page .header").append("<div class='circleStyle1'></div><div class='circleStyle2'></div><div class='circleStyle3'></div><div class='circleStyle4'></div><div class='circleStyle5'></div><div class='circleStyle6'></div>")
}

/*
 * 最新动态滚动
 */
function latestScrolling() {
	var scrollUl = $(".home-page .latest-news .for-scroll ul");
	setInterval(function() {
		var firstLi = $(".home-page .latest-news .for-scroll ul li:first-child");
		var firstLiCloned = firstLi.clone();
		scrollUl.append(firstLiCloned);
		scrollUl.animate({
			top: '-=122px'
		}, 800);
		setTimeout(function() {
			firstLi.remove();
			scrollUl.animate({
				top: '+=122px'
			}, 0);
		}, 800);
	}, 8000);
}

function addContent() {
	//浏览量
	$(".home-page .assortment .page-views").before("<span class='page-views-cont'>浏览量:</span>");
	//下载量
	$(".home-page .assortment .downloads").before("<span class='downloads-cont'>下载量:</span>");
	//调换评论数与星星之间的位置
	var commentCount = $(".home-page .assortment .CommentCount").clone();
	$(".home-page .assortment .CommentCount").remove();
	var comments = $(".home-page .assortment .comment");
	for (var i = 0; i < commentCount.length; i++) {
		comments.eq(i).prepend(commentCount.eq(i));
	}
	//图片轮播
//	$(".home-page .latest-news").after(slideDiv);
	//海量文档/最近热搜/上传排行
//	slideDiv.after(countHotUpload);
	//热门推荐的标题
	$(".home-page .assortHeader").append(assortHot);
	//在热门推荐的每个li外面套一个div
	$oneDocs = $(".home-page .assortment .one-document li");
	$slideDivs = new Array();
	for(var i=0; i<$oneDocs.length;i++){
		$slideDivs[i] = $("<div class='slides'>" + $oneDocs.eq(i).html() + "</div>")
		$oneDocs.eq(i).empty();
		$oneDocs.eq(i).append($slideDivs[i]);
	}
	
	$introP1 = $("<p class='intro'>作为JavaScript技术经典名著，它承继了之前版本全面深入、贴近实战的特点，在详细讲解了JavaScript语言的核心之后......</p>")
	$introP2 = $("<p class='intro'>它将最有用的CSS技术汇总在一起，还总结了CSS设计中的最佳实践，讨论了解决各种实际问题的技术，填补了一直以来CSS图书......</p>")
	$introP3 = $("<p class='intro'>《HTML5实战》是一本全面介绍运用HTML5开发Web应用的书籍，包括了数据存储、通信以及如何创建视频游戏等诸多内容，全书......</p>")
	$introP4 = $("<p class='intro'>全面介绍了如何使用Java Web中的流行技术开发Java EE应用程序，书中对JSP+Servlet+JavaBean和Struts 2+Spring+......</p>")
	$introP5 = $("<p class='intro'>循序渐进地对jQuery的各种函数和方法调用进行了介绍，读者可以系统地掌握jQuery的选择器、DOM操作、事件和动画、AJAX......</p>")
	$introP6 = $("<p class='intro'>在有关算法的书中，有一些叙述非常严谨，但不够全面；另一些涉及了大量的题材，但又缺乏严谨性。《算法导论（原书第3版......</p>")
	$introP7 = $("<p class='intro'>《深入PHP：面向对象、模式与实践（第3版）》是PHP专家经典力作的最新版本。书中主要介绍了如何使用面向对象技术和设......</p>")
	$introP8 = $("<p class='intro'>本书全面介绍了Android应用开发的相关知识，全书内容覆盖了Android用户界面编程、Android四大组件、Android资源访问......</p>")
	$oneDocs.eq(0).append($introP1);
	$oneDocs.eq(1).append($introP2);
	$oneDocs.eq(2).append($introP3);
	$oneDocs.eq(3).append($introP4);
	$oneDocs.eq(4).append($introP5);
	$oneDocs.eq(5).append($introP6);
	$oneDocs.eq(6).append($introP7);
	$oneDocs.eq(7).append($introP8);
}

function rotate3d() {
	var deg1 = 180;
	var deg2 = 180;
	setTimeout(function() {
		$(".home-page .hot-search-comment .container-3d1").css({
			"transform": "rotateY(" + deg2 + "deg)"
		})
		deg2 += 180;
	}, 3000)
	setTimeout(function() {
		$(".home-page .hot-search-comment .container-3d").css({
			"transform": "rotateX(" + deg1 + "deg)"
		})
		deg1 += 180;
	}, 4000)
	setInterval(function() {
		$(".home-page .hot-search-comment .container-3d").css({
			"transform": "rotateX(" + deg1 + "deg)"
		})
		deg1 += 180;
	}, 30000)
	setInterval(function() {
		$(".home-page .hot-search-comment .container-3d1").css({
			"transform": "rotateY(" + deg2 + "deg)"
		})
		deg2 += 180;
	}, 28000)
}

function setScrollStyle(){
	$(".home-page .one-assortment .for-msScroll").mCustomScrollbar({
		theme:"dark-thin",
		scrollButtons:{
			enable:false
		},
		autoHideScrollbar:true,
		scrollInertia:100,
		horizontalScroll:false,
	});	
}


function setBodyMinHeight(){
	var minHeight = window.innerHeight
	$("body").css({"min-height":minHeight+"px"});
}

function addDisabledListener(){
    $(".page-divider .disabled").click(function(){
        return false;
    });
}
